package leetcode.code082;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;
import leetcode.helper.tree.ListNode;

public abstract class Solution082 implements IDebug {

	abstract public ListNode deleteDuplicates(ListNode head);

	@Override
	public void debug1() {
//		输入：head = [1,2,3,3,4,4,5]
//		输出：[1,2,5]
		String head = "[1,2,3,3,4,4,5]";
		String output = "[1,2,5]";
		this.debug(head, output);
	}

	private void debug(String headstr, String output) {
		ListNode head = new ListNode().setArray(HelpDebug.str2array3(headstr));
		ListNode result = this.deleteDuplicates(head);
		HelpDebug.compare(new ListNode().setArray(HelpDebug.str2array3(output)), result);
	}

	@Override
	public void debug2() {
//		输入：head = [1,2,3,3,4,4,5]
//		输出：[1,2,5]
		String head = "[1,1,1,2,3]";
		String output = "[2,3]";
		this.debug(head, output);
	}

	@Override
	public void debug3() {
		String head = "[1,1,1,2,2,2,2,2,3,3,3,3,3,4]";
		String output = "[4]";
		this.debug(head, output);
	}

	@Override
	public void debug4() {
		String head = "[1,2,3,3,4,4,5]";
		String output = "[1,2,5]";
		this.debug(head, output);
	}

}
